﻿@{
    ViewBag.Title = "Form";
    Layout = "~/Views/Shared/_ManufactureList.cshtml";
}
<style type="text/css">
    .ui-jqgrid .ui-jqgrid-pager .ui-pager-table,
    .ui-jqgrid .ui-jqgrid-toppager .ui-pager-table {
        width: 95%;
    }
    a.choose_mold {
        font-weight: bold;
        text-decoration:underline;
    }
</style>
<script type="text/javascript">
    $(function () {
        initControl();
        gridList();
    });
    function initControl() {
        
    }
    function gridList() {
        var $gridList = $("#gridList");
        $gridList.dataGrid({
            url: "/BOM/Manufacture/GetMoldListJson",
            height: 198,
            colModel: [
                {
                    label: '选择', name: 'MoldNO', width: 60, align: 'center', sortable: false, frozen: true, formatter: function (cellvalue) {
                        return '<a id="" class="choose_mold" href="javascript:;" onclick="do_choose_mold(\'' + cellvalue + '\')" style="width:45px;">选择</a>';
                    }
                },
                { label: '模具编号', name: 'MoldNO', width: 160, align: 'left', sortable: false },
                { label: '模具名称', name: 'MoldName', width: 130, align: 'left', sortable: false },
                { label: '模具尺寸', name: 'MoldSize', width: 130, align: 'left', sortable: false },
            ],
            pager: "#gridPager",
            sortname: 'MoldNO asc',
            viewrecords: true,
            rownumWidth: 40,
            ondblClickRow: function (rowid) {
                var rowData = $gridList.jqGrid('getRowData', rowid);
                do_choose_mold(rowData.MoldNO);
                
            }
        });
        $gridList.jqGrid('setLabel', 0, '序号', 'rowNumberHeaderStyle');
        $("#btn_search").click(function () {
            $gridList.jqGrid('setGridParam', {
                postData: { keyword: $("#txt_keyword").val() },
            }).trigger('reloadGrid');
        });
    }
    function do_choose_mold(number) {
        var father = $.currentSubWindow().frames["Detail"];
        father.do_choose_mold(number);
    }
</script>
<div id="layout" style="height: 100%; width: 100%; ">
    <div style="padding: 12px 0 5px 0; padding-left: 15px; border-bottom: 1px solid #ccc; " class="line-table input-width-185">
        <label class="prefix">模具</label> <input id="txt_keyword" type="text" class="form-control" />
        <div class="btn-group" style="">
            <a id="btn_search" class="btn btn-primary center-block btn-1" onclick=""><span class="glyphicon glyphicon-search"></span> 检索</a>
        </div>
    </div>
    <div>
        <table id="gridList"></table>
        <div id="gridPager"></div>
    </div>
</div>

